package com.fpost.manager;

import java.util.List;

import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

import com.fpost.dao.impl.ArticleRatingDAO;
import com.fpost.domain.ArticleRating;

public class ArticleRatingManager {
	
	public Long save(ArticleRating articleRating) throws HibernateException {
		ArticleRatingDAO dao = new ArticleRatingDAO();
		return dao.save(articleRating);
	}

	public void delete(long id) throws HibernateException {
		ArticleRatingDAO dao = new ArticleRatingDAO();
		dao.delete(id);
	}


	public void delete(ArticleRating articleRating) throws HibernateException {
		ArticleRatingDAO dao = new ArticleRatingDAO();
		dao.delete(articleRating);
	}

	public ArticleRating get(long id) throws HibernateException {
		ArticleRatingDAO dao = new ArticleRatingDAO();
		return dao.get(id);
	}

	public void saveOrUpdate(ArticleRating articleRating) throws HibernateException {
		ArticleRatingDAO dao = new ArticleRatingDAO();
		dao.saveOrUpdate(articleRating);

	}

	public List<ArticleRating> getAll() throws HibernateException {
		ArticleRatingDAO dao = new ArticleRatingDAO();
		return dao.getAll();
	}
	
	public List<ArticleRating> getRatingsByArticleId(long articleId) throws HibernateException {
		ArticleRatingDAO dao = new ArticleRatingDAO();
		return dao.getRatingsByArticleId(articleId);		
	}
}
